let baseUrl = 'https://meituan.thexxdd.cn/api';

const Request=(url,data,method)=>new Promise((resolve,reject)=>{
	uni.showLoading({
		title: '加载中...'
	});
	uni.request({
		url: baseUrl+ url,
		data:data || '',
		method:method,
		success:res=>{ 
			uni.hideLoading();
           if(res.statusCode==200){
			  resolve(res.data)   
		   }else{
			   reject(res.data.meta.msg)
		   }
		},
		fail:err=>{
			uni.hideLoading();
			reject(err)
		}
	})
})

const api ={
	get:(url,data)=>Request(url,data),
	post:(url,data)=>Request(url,data,method)
}

export default api